*Get full sample with fields*
clear
use "Data\before_reduction.dta"


**Reduce to program level**
*First, panel dimension of individuals

bysort pnr: egen last_year=max(age)
keep if last_year==age
drop last_year

*Second, reduced in the individuals dimension to get program averages
drop if final_educ==. | final_educ==1
sort final_educ


foreach i in ever_top_manager age_at_first_kid age_at_first_kid_women life_time_earnings avr_wealth wealth_50 avr_participation avr_ft_if_par{
rename `i' temp
by final_educ: egen `i'=mean(temp)
drop temp
}

by final_educ: egen educ_count=count(final_educ)

collapse (first) fined final_educ_level_4 final_field_num final_field wage_start_mean_ambition wage_growth_ambition wage_start_mean_ambition_s wage_growth_ambition_s ambition_type_k_4_s goldin_quotient goldin_quotient_s p_life_wage p_life_earnings ever_top_manager age_at_first_kid age_at_first_kid_women life_time_earnings avr_wealth wealth_50 avr_participation avr_ft_if_par educ_count, by(final_educ)


*Save regressions sample*
save "Results\tab_A3\regression_sample.dta", replace
